package com.tool_stdy.ConcurrencyModel.Disruptor;

import com.lmax.disruptor.WorkHandler;

import java.util.concurrent.CountDownLatch;

/**
 * Created by yan_li on 2016/11/11.
 */
public class TradeHandler implements WorkHandler<Task> {

    private CountDownLatch latch;

    public  void setCountDownLatch(CountDownLatch latch) {
        this.latch = latch;
    }

    @Override
    public void onEvent(Task task) throws Exception {
        System.out.println(Thread.currentThread().getName() + "==" + task.getPrice());
        latch.countDown();
        Thread.sleep(100);
    }

}
